<template>

    <!-- 添加或修改对话框 -->
    <lam-dialog :title="title" :visible.sync="open" width="680px" append-to-body @close="cancel">
      <el-form :ref="formRef" :model="form" :rules="rules" label-width="100px" :disabled="formDisabled">
        <el-row>
          <el-col :span="12">
            <el-form-item label="商品ID" prop="prodId">
              <el-input-number v-model="form.prodId" clearable controls-position="right" :min="0" style="width: 100%;"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="订单号" prop="orderNumber">
              <el-input v-model="form.orderNumber" clearable placeholder="" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="订单项ID" prop="orderItemId">
              <el-input-number v-model="form.orderItemId" clearable controls-position="right" :min="0" style="width: 100%;"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="评论用户ID" prop="userId">
              <el-input v-model="form.userId" clearable placeholder="" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="评价" prop="evaluate">
              <lam-dict-select v-model="form.evaluate" dictCode="evaluate_type" placeholder="" clearable />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="评论内容" prop="content">
              <el-input v-model="form.content" type="textarea" autosize placeholder="" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="得分，0-5分" prop="score">
              <el-input-number v-model="form.score" clearable controls-position="right" :min="0" style="width: 100%;"/>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="掌柜回复" prop="replyContent">
              <el-input v-model="form.replyContent" type="textarea" autosize placeholder="" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="回复时间" prop="replyTime">
              <el-date-picker type="datetime" v-model="form.replyTime" value-format="yyyy-MM-dd HH:mm:ss" clearable placeholder="" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="是否已回复" prop="replyStatus">
              <lam-dict-select v-model="form.replyStatus" dictCode="yn10" placeholder="" clearable />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="IP来源" prop="postip">
              <el-input v-model="form.postip" clearable placeholder="" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="有用的计数" prop="usefulCounts">
              <el-input-number v-model="form.usefulCounts" clearable controls-position="right" :min="0" style="width: 100%;"/>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="晒图的图片" prop="pics">
              <el-input v-model="form.pics" type="textarea" autosize placeholder="" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="是否匿名" prop="isAnonymous">
              <lam-dict-select v-model="form.isAnonymous" dictCode="yn10" placeholder="" clearable />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="是否显示，1:为显示，0:待审核， -1：不通过审核，不显示。 如果需要审核评论，则是0,，否则1" prop="status">
              <lam-dict-select type="radio" v-model="form.status" dictCode="yn10" placeholder="" />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm" :loading="loading">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </lam-dialog>
    
</template>

<script>
import { EditMixin } from '@/components/mixins/EditMixin';

export default {
  name: "EditProdComm",
  mixins:[EditMixin],
  data() {
    return {
      url: {
        base: '/mall/prodComm/'
      },
      // 表单校验
      rules: {
        prodId: [{ required: true, message: "商品ID不能为空", trigger: "blur" }],
        orderNumber: [{ required: true, message: "订单号不能为空", trigger: "blur" }],
      },
    };
  },
  created() {
  },
  methods: {
    // 表单重置
    reset() {
      this.form = {
        prodId: null,
        orderNumber: null,
        orderItemId: null,
        userId: null,
        evaluate: 0,
        content: null,
        score: null,
        replyContent: null,
        replyTime: null,
        replyStatus: 0,
        postip: null,
        usefulCounts: null,
        pics: null,
        isAnonymous: 0,
        status: 0
      };
    },
    
    /** 提交按钮 */
    submitForm(){
      this.saveForm(this.url.base);
    }

  }
};
</script>
